package com.quiz.bis.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.quiz.bis.domain.model.*;
import com.quiz.bis.domain.vo.QuestionDetailVo;
import com.quiz.bis.domain.vo.QuestionVo;
import com.quiz.common.mybatis.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 题目持久层接口
 * @author ahuan
 */
@Mapper
public interface QuestionMapper extends BaseMapperPlus<Question> {
    Page<QuestionVo> selectQuestionList(@Param("page") Page<Question> page, @Param("query") QuestionQuery query);
    Page<QuestionDetailVo> selectQuestionList2(@Param("page") Page<Question> page, @Param("query") QuestionQuery query);
    List<QuestionDetailVo> selectQuestionDetailListByIds(@Param("questionIds") List<Long> questionIds);
    List<QuestionDetailVo> selectQuestionPaperListByIds(@Param("questionIds") List<Long> questionIds);
    List<QuestionDetailVo> selectQuestionListByQuery(QuestionQuery query);
    Page<QuestionDetailVo> fulltextSearch(@Param("page") Page<Question> page, @Param("keyword") String keyword,
                                    @Param("categoryId") Long categoryId);
    Long selectCountByIds(@Param("ids") Long[] ids);
    List<QuestionDetailVo> selectQuestionListByIds(@Param("ids") List<Long> ids);
    QuestionDetailVo selectQuestionById(@Param("id") Long id);
    List<QuestionOption> selectOptionsByQuestionIds(@Param("questionIds") List<Long> questionIds);
    List<QuestionAnswer> selectAnswersByQuestionIds(@Param("questionIds") List<Long> questionIds);

    Page<QuestionDetailVo> findSimilarBySimHash(@Param("page") Page<Question> page,@Param("simHash") long simHash,@Param("id") Long id);

    Page<QuestionDetailVo> findByKnowledgeDifferentDifficulty(@Param("page") Page<Object> page, @Param("typeId") Long typeId, @Param("questionIds") List<Long> questionIds);
    Page<QuestionDetailVo> findByDifficultyDifferentKnowledge(@Param("page") Page<Object> page, @Param("typeId") Long typeId, @Param("difficulty") Integer difficulty, @Param("questionIds") List<Long> questionIds);
    List<QuestionDetailVo> findRandomQuestions(@Param("page") Page<Object> page, @Param("typeId") Long typeId);



}